home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-05-27 | 1.8 KB | 56 lines | [TEXT/YERK] |
- \ fInterpret -- Replaces INTERPRET; provides interpretation of floats
- \ 5/11/85 ssg Version 1.0
- \ 9/19/85 cbd Modified for floating point heap.
- \ 8/16/86 cdn Replace setupFP with FPinit
- \ 5/27.92 rfl moved fpmodel stuff from fval to here; need finterpret running
-
- ( addr -- flt t OR f) \ Attempts to convert token at addr to a float.
- : fnumber atof: floati/o ;
-
- \ Write a float into dictionary: analogous to , or c, .
- \ ( flt -- )
- \ : f, dup 2+ here 10 cmove 10 allot fdrop ;
-
- ( b flt -- ) \ Compiles an in-line float
- : fLiteral state IF compile flit f, ELSE swap THEN ; immediate
-
-
- ( -- b) \ True means string at here is a float.
- : fFind here fnumber dup
- IF swap [compile] fLiteral THEN ;
-
- ( -- ) \ Adds ability to interpret floats to INTERPRET.
- : fInterpret
- BEGIN find
- IF state <
- IF cfa , ELSE cfa execute THEN
- ELSE fFind not \ fFind returns true if float found.
- IF here number dpl 1+
- IF [compile] dliteral
- ELSE drop [compile] literal
- THEN
- THEN
- THEN ?stack ?dp
- AGAIN ;
-
- \ store this word in OBJINIT to start up with float enabled
- : FPinit init: floatI/O init: fltMem ;
-
- \ new error handler for use with floating point extensions
- : cleanFloat clean2 init: fltMem ;
-
- \ Install finterpret as the new INTERPRET.
- : yerk>flt 'c finterpret -> interpret
- 'c cleanFloat -> abortVec ;
-
- \ Install INTERPRET in nucleus, disabling floating-pt parsing
- : yerk>int 0 -> interpret
- 'c yerk -> objInit
- 'c clean2 -> abortVec ;
-
- yerk>flt
-
- 0. fvalue fpmodel
-
- 'code fpmodel -> fvalcode \ patch value in Args file
-